﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Layout.Master" AutoEventWireup="true" CodeBehind="wfSalesByProduct.aspx.cs" Inherits="Dragon.wfSalesByProduct" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
    .auto-style4 {
    }
    .auto-style5 {
            width: 108px;
        }
    .auto-style6 {
        text-align: center;
        }
    .auto-style7 {
        width: 149px;
    }
        .auto-style8 {
            width: 89px;
        }
        .auto-style9 {
            width: 100%;
            border: 2px solid #0000FF;
        }
        .auto-style10 {
            width: 195px;
        }
        .auto-style11 {
            width: 98px;
        }
        .auto-style15 {
            width: 153px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">    
    <table class="auto-style9" style="border-color: #666633">        
        <tr>
            <td class="auto-style8">Từngày:</td>
            <td class="auto-style7">
                <asp:TextBox ID="txtFromDate" runat="server" Width="150px">01/06/2015</asp:TextBox>
                <cc1:CalendarExtender ID="txtFromDate_CalendarExtender" runat="server" BehaviorID="txtFromDate_CalendarExtender" TargetControlID="txtFromDate" Format="dd/MM/yyyy" />
            </td>
            <td class="auto-style5">Tỉnh thành</td>
            <td class="auto-style10">
                <cc1:ComboBox ID="ddlProvince" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="Code" DropDownStyle="DropDownList" MaxLength="0" style="display: inline;" Width="150px">
                </cc1:ComboBox>
            </td>
            <td class="auto-style11">
                Loại báo cáo</td>
            <td class="auto-style15">
                <cc1:ComboBox ID="ddlType" runat="server" DropDownStyle="DropDownList" Width="150px">
                    <asp:ListItem Selected="True">Doanh thu (VNĐ)</asp:ListItem>
                    <asp:ListItem>Đơn vị (Két/Thùng)</asp:ListItem>
                </cc1:ComboBox>
            </td>
            <tr>
            <td class="auto-style8">Đến ngày</td>
            <td class="auto-style7">
                <asp:TextBox ID="txtToDate" runat="server" Width="150px">30/06/2015</asp:TextBox>
                <cc1:CalendarExtender ID="txtToDate_CalendarExtender" runat="server" BehaviorID="txtToDate_CalendarExtender" TargetControlID="txtToDate" Format="dd/MM/yyyy" />
            </td>
            <td class="auto-style5">Nhà phân phối</td>
            <td class="auto-style10">
                <cc1:ComboBox ID="ddlDistributor" runat="server" DataSourceID="SqlDataSource2" DataTextField="Name" DataValueField="Code" MaxLength="0" style="display: inline;" DropDownStyle="DropDownList" OnDataBound="DistributorDataBound" Width="250px">
                </cc1:ComboBox>
            </td>
            <td class="auto-style11">
                Khách hàng</td>
            <td class="auto-style15">
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                <cc1:AutoCompleteExtender ServiceMethod="Search" MinimumPrefixLength="5" CompletionInterval="100" EnableCaching="False" CompletionSetCount="10"
                    TargetControlID="TextBox1" ID="TextBox1_AutoCompleteExtender" runat="server" FirstRowSelected="false">
                </cc1:AutoCompleteExtender>
            </td>
        </tr>
        <tr>
            <td class="auto-style6" colspan="6">
                <asp:Button ID="btnRunReport" runat="server" style="text-align: center" Text="Xem báo cáo" OnClick="btnRunReport_Click" />
                <cc1:ComboBox ID="ddlCustomer" runat="server" DataSourceID="SqlDataSource3" DataTextField="Name" DataValueField="Code" DropDownStyle="DropDownList" MaxLength="0" style="display: inline;" Width="250px" OnDataBound="CustomerOnDataBound" Visible="False">
                </cc1:ComboBox>
            </td>
        </tr>
        <tr>
            <td class="auto-style4" colspan="6">                
                <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" 
                    WaitMessageFont-Size="14pt" Width="100%" Height="530px">
                    <LocalReport ReportPath="Report\rpSalesByProductRevenues.rdlc">
                        <DataSources>
                            <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="dsSalesByProductRevenues" />
                        </DataSources>
                    </LocalReport>
                </rsweb:ReportViewer>
                <rsweb:ReportViewer ID="ReportViewer2" runat="server" Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" 
                    WaitMessageFont-Size="14pt" Width="100%" Height="530px">
                    <LocalReport ReportPath="Report\rpSalesByProductUnitSold.rdlc">
                        <DataSources>
                            <rsweb:ReportDataSource DataSourceId="ObjectDataSource2" Name="dsSalesByProductRevenues" />
                        </DataSources>
                    </LocalReport>
                </rsweb:ReportViewer>
            </td>
        </tr>
    </table>  
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CarlsbergConnectionString %>" SelectCommand="SELECT * FROM [Province] WHERE ([Status] = @Status)">
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="Status" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>

    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:CarlsbergConnectionString %>" 
        SelectCommand="SELECT * FROM [vwDistributor] WHERE ([PCode] = @PCode)">
        <SelectParameters>
            <asp:ControlParameter ControlID="ddlProvince" Name="PCode" PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>

    <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:CarlsbergConnectionString %>" SelectCommand="SELECT [Code], [Name] FROM [Customer] WHERE ([Address] = @Address)">
        <SelectParameters>
            <asp:Parameter DefaultValue="~" Name="Address" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>

    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Delete" InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="Dragon.Dataset.dsSalesByProductRevenuesTableAdapters.ReportSalesByProductRevenuesTableAdapter" UpdateMethod="Update">
        <DeleteParameters>
            <asp:Parameter Name="Original_ID" Type="Int64" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="BrandName" Type="String" />
            <asp:Parameter Name="ProductName" Type="String" />
            <asp:Parameter Name="Unit" Type="String" />
            <asp:Parameter Name="Revenues" Type="Double" />
            <asp:Parameter Name="Share" Type="Double" />
            <asp:Parameter Name="Cumulative" Type="Double" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="BrandName" Type="String" />
            <asp:Parameter Name="ProductName" Type="String" />
            <asp:Parameter Name="Unit" Type="String" />
            <asp:Parameter Name="Revenues" Type="Double" />
            <asp:Parameter Name="Share" Type="Double" />
            <asp:Parameter Name="Cumulative" Type="Double" />
            <asp:Parameter Name="Original_ID" Type="Int64" />
        </UpdateParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" DeleteMethod="Delete" InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="Dragon.Dataset.dsSalesByProductUnitSoldTableAdapters.ReportSalesByProductUnitSoldTableAdapter" UpdateMethod="Update">
        <DeleteParameters>
            <asp:Parameter Name="Original_ID" Type="Int64" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="BrandName" Type="String" />
            <asp:Parameter Name="ProductName" Type="String" />
            <asp:Parameter Name="Unit" Type="String" />
            <asp:Parameter Name="UnitSold" Type="Int32" />
            <asp:Parameter Name="Share" Type="Double" />
            <asp:Parameter Name="Cumulative" Type="Double" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="BrandName" Type="String" />
            <asp:Parameter Name="ProductName" Type="String" />
            <asp:Parameter Name="Unit" Type="String" />
            <asp:Parameter Name="UnitSold" Type="Int32" />
            <asp:Parameter Name="Share" Type="Double" />
            <asp:Parameter Name="Cumulative" Type="Double" />
            <asp:Parameter Name="Original_ID" Type="Int64" />
        </UpdateParameters>
    </asp:ObjectDataSource>
</asp:Content>
